using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace Microsoft.Practices.Repository
{
    /// <summary>
    /// This exception is thrown when a concurrency
    /// violation is detected in the database.
    /// </summary>
    [Serializable]
    public class ConcurrencyViolationException : RepositoryException
    {
        /// <summary>
        /// Initializes a new instance of ConcurrencyViolationException.
        /// </summary>
        public ConcurrencyViolationException()
        {
        }

        /// <summary>
        /// Initilizes a new instance of ConcurrencyViolationException.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        public ConcurrencyViolationException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of ConcurrencyViolationException.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        /// <param name="inner">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
        public ConcurrencyViolationException(string message, Exception inner)
            : base(message, inner)
        {
        }

        /// <summary>
        /// Initializes a new instance of ConcurrencyViolationException.
        /// </summary>
        /// <param name="info">The System.Runtime.Serialization.SerializationInfo that holds the serialized data
        /// about the exception being thrown.</param>
        /// <param name="context">The System.Runtime.Serialization.SerializationContext that contains contextual informationa about
        /// the source or destination.</param>
        protected ConcurrencyViolationException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
    }
}
